package com.zhhtech.zhh.bean

import android.os.Parcelable
import com.zhhtech.zhh.R
import com.zhhtech.zhh.ui.listener.OnCheckBean
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
import kotlinx.parcelize.Parcelize

data class TokenBean(
    val token: String = "",
    val phone: String = "",
)

data class UserInfoBean(
    var phone: String = "",
    var inviteCode: String = "",
    var nickname: String = "",
    var isBindInviter: Boolean = false,
    var bindInviterPhone: String = "",
    var bindInviterCode: String = "",
    var balance: String = "",
    var inviteNum: String = "",
    var inviteIncome: String = "",
)

data class Version(
    val updateStatus: Int = 0,
    val remark: String = "有新版本",
    val downloadUrl: String = "",
)

data class SysUserInit(
    val userName: String = "",
    val modify: Int? = null,
)

/**
 * 数据中台分页对象
 */
data class PageInfo<T>(
    val list: MutableList<T>? = null,
)

/**
 * 深粮云分页对象
 */
data class Page<T>(
    val total: Int = 0,
    val records: MutableList<T>? = null,
)

data class SysConfig(
    val configId: Int = 0,
    val configKey: String = "",
    val configName: String = "",
    val configType: String = "",
    val configValue: String = "",
)

@Parcelize
data class CommonCheck(
    val name: String,
    val key: String,
    override var check: Boolean = false,
    override val showName: String = name,
    override val param: String? = key,
) : Parcelable, OnCheckBean

data class AppVersion(
    val versionName: String = "",
    val url: String = "",
    val remark: String = "",
)

data class HomeBean(
    val banner: MutableList<HomeBannerBean> = mutableListOf(),
    val caseList: MutableList<HomeCaseBean> = mutableListOf(),
)

data class HomeBannerBean(
    val url: String = "",
    val imageUrl: String = "",
)

@Parcelize
data class HomeCaseBean(
    val id: String = "",
    val imageUrl: String = "",
    val title: String = "",
    val content: String = "",
    val username: String = "",
    val solution: String = "",
    val money: String = "",
    val work: String = "",
    val loanType: String = "",
    val images: MutableList<String> = mutableListOf(),
) : Parcelable

data class CaseConfig(
    val loanType: MutableList<GetConfig> = mutableListOf(),
    val newLoadType: MutableList<GetConfig> = mutableListOf(),
    val overdueType: MutableList<GetConfig> = mutableListOf(),
    val moneyType: MutableList<GetConfig> = mutableListOf(),
    val weCom: String = "",
    val phone: String = "",
    val contactNumber: String = "",
    val weComImg: MutableList<String> = mutableListOf(),
    val jump: JumpLink = JumpLink(),
)

data class GetConfig(
    val id: String = "",
    val name: String = "",
    override var check: Boolean = false,
    override val showName: String = name,
    override val param: String? = id,
) : OnCheckBean

class FuZhai {
    var pingtai: String = ""
    var jine: String = ""
    var fzsj: String = ""
    var hzsj: String = ""
}


data class OrderProcess(
    val processList: MutableList<CaseProcess> = mutableListOf(),
)

data class CaseProcess(
    val iconImage: String = "",
    val processType: String = "",
    val title: String = "",
    val subTitle: String = "",
    val processStatus: String = "",
)

enum class ProcessType(
    private val typeName: String,
    private val checkResId: Int,
    private val unCheckResId: Int,
) {
    INTENTION("intention", R.mipmap.lcyellow2, R.mipmap.lcgrey02),
    SUBMIT("submit", R.mipmap.lcyellow1, R.mipmap.lcgrey01),
    HANDLE("handle", R.mipmap.lcyellow3, R.mipmap.lcgrey03),
    FINISH("finish", R.mipmap.lcyellow4, R.mipmap.lcgrey04),
    CANCEL("cancel", R.mipmap.lcyellow4, R.mipmap.lcgrey04);

    companion object {
        @JvmStatic
        private val values: Array<ProcessType> = ProcessType.values()

        @JvmStatic
        fun readResId(processType: String, check: Boolean): Int {
            return (values.find { it.typeName == processType } ?: FINISH).let {
                if (check) it.checkResId else it.unCheckResId
            }
        }
    }
}

@Parcelize
data class ShareBean(
    val title: String = "",
    val subTitle: String = "",
    val link: String = "",
) : Parcelable

data class InviteList(
    val totalNum: String = "",
    val todayNum: String = "",
    val list: MutableList<InviteBean> = mutableListOf(),
)

data class InviteBean(
    val phone: String = "",
    val crateAt: String = "",
    val income: String = "",
)

data class IncomeBean(
    val inType: String = "",
    val title: String = "",
    val createAt: String = "",
    val amount: String = "",
)

data class CaseOrderBean(
    val statusText: String = "",
    val id: String = "",
    val loanType: String = "",
    val createAt: String = "",
    val amount: String = "",
    val orderStatus: String = "",
    val plan: MutableList<String> = mutableListOf(),
)

data class JumpLink(
    val type: Int = 1,
    val link: String = "",
    val path: String = "",
    val userName: String = "",
    val miniprogramType: Int = WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_PREVIEW,
)

data class UserLogOut(
    val tips: String = "",
)